package net.chenlin.dp.base.manager.impl;

import net.chenlin.dp.base.dao.CompanyMapper;
import net.chenlin.dp.base.entity.CompanyEntity;
import net.chenlin.dp.base.manager.CompanyManager;
import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 公司管理
 *
 * @author ZhouChenglin
 * @email yczclcn@163.com
 * @url www.chenlintech.com
 * @date 2018年2月02日 下午4:38:09
 */
@Component("companyManager")
public class CompanyManagerImpl implements CompanyManager {

	@Autowired
	private CompanyMapper companyMapper;
	

	@Override
	public List<CompanyEntity> listDpCompany(Page<CompanyEntity> page, Query search) {
		return companyMapper.listForPage(page, search);
	}

	@Override
	public int saveDpCompany(CompanyEntity dpCompany) {
		return companyMapper.save(dpCompany);
	}

	@Override
	public CompanyEntity getDpCompanyById(Long id) {
		CompanyEntity dpCompany = companyMapper.getObjectById(id);
		return dpCompany;
	}

	@Override
	public int updateDpCompany(CompanyEntity dpCompany) {
		return companyMapper.update(dpCompany);
	}

	@Override
	public int batchRemove(Long[] id) {
		int count = companyMapper.batchRemove(id);
		return count;
	}
	
}
